package com.springcloud.api.controller;

import com.netflix.discovery.shared.Applications;
import com.springcloud.api.service.ProductService;
import com.springcloud.model.base.Res.BaseRes;
import org.springframework.aop.target.LazyInitTargetSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

/**
 * @author shengtao
 * @Description:
 * @date 2019/06/04 21:01
 */
@RestController
public class ApiController {

    @Autowired
    private ProductService productService;

    @Autowired
    private DiscoveryClient discoveryClient;

    @RequestMapping(value = "/test",method = RequestMethod.GET)
    public BaseRes test(){
        List<String> regions = discoveryClient.getServices();
        return BaseRes.success(productService.list());
    }

}
